home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_jsbrwmn.asp < prev    next >
Encoding:
Text File  |  1999-07-09  |  5.9 KB  |  291 lines

  1. <%@ LANGUAGE=VBScript %>
  2. <% Option Explicit %>
  3. <!-- #include file="../directives.inc" -->
  4.  
  5. <!--#include file="jsbrowser.str"-->
  6. <!--#include file="iisetfnt.inc"-->
  7.  
  8. <% 
  9.  
  10.  
  11. Const FIXEDDISK = 2
  12.  
  13. Dim path, FileSystem, drives, drive, primarydrive
  14.  
  15. path = Request.Cookies("HTMLA")("LASTPATH")
  16.  
  17. If path = "" Then
  18.     Set FileSystem=CreateObject("Scripting.FileSystemObject")
  19.     Set drives = FileSystem.Drives
  20.  
  21.     For Each drive in drives
  22.         primarydrive = drive    
  23.         
  24.         'exit after the first FIXEDDISK if there is one...
  25.         if drive.DriveType = FIXEDDISK then
  26.             Exit For            
  27.         end if
  28.         
  29.     Next
  30.     
  31.     primarydrive = primarydrive & L_SLASH_TEXT
  32.  
  33.     Response.Cookies("HTMLA")("LASTPATH")=primarydrive
  34.     path = primarydrive
  35. End If
  36. %>
  37.  
  38. <HTML>
  39. <HEAD>
  40.     <TITLE></TITLE>
  41.     
  42.     <SCRIPT LANGUAGE="JavaScript">
  43.     
  44.     var DRIVE= 0;
  45.     var FOLDER = 1;
  46.     var FILE = 2;
  47.     </SCRIPT>
  48. </HEAD>
  49.  
  50. <BODY BGCOLOR="<%= Session("BGCOLOR") %>" LINK="#000000" VLINK="#000000" TEXT="#000000" TOPMARGIN=0 LEFTMARGIN=10 onLoad="loadList();">
  51. <FORM NAME="userform" onSubmit="return false;">
  52.  
  53. <TABLE>
  54. <TR><TD>
  55.         <%= sFont("","","",True) %>
  56.             <%= L_LOOKIN_TEXT %>
  57.         </FONT>
  58.     </TD>
  59.     <TD>
  60.     <INPUT TYPE="text" NAME="currentPath" VALUE="<%= path %>" SIZE = 50 OnBlur="changeDir(this.value);">
  61.     </TD>
  62.     <TD>
  63.         <A HREF="javascript:upDir();"><IMG SRC="updir.GIF" WIDTH=23 HEIGHT=22 BORDER=0></A>
  64.     </TD>
  65.     </TR>
  66. </TABLE>
  67. </FORM>
  68.  
  69. <SCRIPT LANGUAGE="JavaScript">
  70.     function loadList()
  71.         {
  72.         parent.hlist.location.href = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype;        
  73.         }
  74.     function redrawList()
  75.         {
  76.         parent.list.location.href = "JSBrwLs.asp";        
  77.         }
  78.         
  79.  
  80.     function listFuncs()
  81.         {
  82.         this.loadList = loadList;
  83.         this.sortList = sortList;
  84.         this.SetFilter = SetFilter;
  85.         this.changeDir = changeDir;
  86.         this.setPath = setPath;
  87.         this.selIndex = 0;
  88.         this.sortby = "fname";
  89.         this.sortAsc = true;
  90.         this.filterType = "";
  91.         }
  92.  
  93.  
  94.     function upDir()
  95.         {
  96.         lastpath = document.userform.currentPath.value;
  97.         parent.filter.document.userform.currentFile.value = "";        
  98.         uppath = lastpath;
  99.         while (lastpath.indexOf("<%= L_FWDSLASH_TEXT %>") > -1)
  100.             {
  101.             lastpath = lastpath.substring(0,lastpath.indexOf("<%= L_FWDSLASH_TEXT %>")) + "<%= L_DBLSLASH_TEXT %>" + lastpath.substring(lastpath.indexOf("/")+1,lastpath.length);
  102.             }         
  103.         if (lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>") == lastpath.length-1)
  104.             {
  105.             lastpath = lastpath.substring(0,lastpath.length-1);
  106.             }
  107.         lastwhack = lastpath.lastIndexOf("<%= L_DBLSLASH_TEXT %>");
  108.         if (lastwhack > 0)
  109.             {
  110.             uppath = lastpath.substring(0,lastwhack+1);
  111.             }    
  112.         document.userform.currentPath.value = uppath;            
  113.         if (lastpath.lastIndexOf(":") == lastpath.length-1)
  114.             {
  115.             uppath = ":";
  116.             document.userform.currentPath.value = "";            
  117.             }
  118.  
  119.         changeDir(uppath);
  120.         }
  121.     
  122.     function changeDir(newpath)
  123.         {
  124.         newpath.toUpperCase();
  125.         var thispath = "JSBrwSet.asp?btype=" + top.opener.JSBrowser.browsertype + "&path=" + escape(newpath);
  126.         parent.hlist.location.href = thispath;
  127.         return false;
  128.         }
  129.     
  130.     function setPath()
  131.         {        
  132.         if (top.opener.JSBrowser == null)
  133.             {
  134.                 top.close();
  135.             }
  136.             else
  137.             {
  138.                 top.opener.JSBrowser.currentFile = parent.filter.document.userform.currentFile.value;
  139.                 top.opener.JSBrowser.currentPath = document.userform.currentPath.value;        
  140.                 top.opener.JSBrowser.BrowserObjSetPath();
  141.                 top.location.href = "JSBrwCl.asp";        
  142.             }
  143.         }
  144.     
  145.     function SetFilter(selFilter)
  146.         {
  147.         listFunc.filterType = selFilter.options[selFilter.selectedIndex].value;
  148.         loadList();
  149.         }
  150.  
  151.  
  152.     function numOrder(a,b)
  153.         {
  154.         return a[listFunc.sortby]-b[listFunc.sortby];
  155.         }
  156.  
  157.     function sortList(sortby,sorttype)
  158.         {
  159.         if (sortby != listFunc.sortby)
  160.             {
  161.             listFunc.sortby = sortby;
  162.             listFunc.sortAsc = true;
  163.             }
  164.         else
  165.             {
  166.             listFunc.sortAsc = !listFunc.sortAsc;
  167.             }
  168.  
  169.         if(sortby == "sdate" || sortby == "fsize" )
  170.             cachedList.sort(numOrder);
  171.         else
  172.             cachedList.sort(sortOrder);
  173.             
  174.         if (!listFunc.sortAsc)
  175.             {
  176.             cachedList.reverse();
  177.             }
  178.         redrawList();
  179.         }
  180.  
  181.     function sortOrder(a,b)
  182.         {
  183.         
  184.         astr = (a["oType"] == FOLDER) + a[listFunc.sortby]
  185.         bstr = (b["oType"] == FOLDER) + b[listFunc.sortby]
  186.         
  187.         
  188.         if (astr.toLowerCase() < bstr.toLowerCase())
  189.             {
  190.             return -1;
  191.             }
  192.         else
  193.             {
  194.             if (astr.toLowerCase() > bstr.toLowerCase())
  195.                 {
  196.                 return 1;
  197.                 }
  198.             else
  199.                 {
  200.                 return 0;
  201.                 }
  202.             }
  203.         }
  204.  
  205.         
  206.     function crop(thestring,size)
  207.         {
  208.         if (thestring.length > size)
  209.             {
  210.             thestring = thestring.substring(0,size) + "...";
  211.             }
  212.         return thestring;
  213.         }
  214.  
  215.  
  216.     function fullname(fname,fext)
  217.         {
  218.         if (fext == "")
  219.             {
  220.             return fname;        
  221.             }
  222.         else
  223.             {            
  224.             return (fname + "." + fext);
  225.             }
  226.         }
  227.         
  228.     function formatsize(iStr)
  229.         {
  230.             iStr = parseInt(iStr);
  231.             if (!isNaN(iStr))
  232.             {
  233.                 iStr = Math.round(iStr/1024);
  234.             }
  235.             else
  236.             {
  237.                 iStr = 0
  238.             }
  239.             return iStr;
  240.         }
  241.     
  242.     function getLocaleDate(sDate)
  243.     {
  244.         var oDate = new Date(sDate);
  245.         return oDate.toLocaleString();
  246.     }
  247.  
  248.     function listObj(fpath, fname,fext, fsize, ftype, lngLastUpdated, strLastUpdated, oType)
  249.         {
  250.         this.path = fpath;
  251.  
  252.         if (oType == DRIVE)
  253.         {
  254.             this.icon = "drive.gif";
  255.         }
  256.         else
  257.         {
  258.             if (oType == FOLDER)
  259.                 {
  260.                     this.icon = "dir.gif";
  261.                 }
  262.             else
  263.                 {
  264.                     this.icon = "file.gif";
  265.                 }
  266.         }
  267.         this.oType = oType;
  268.         this.fname = fname;    
  269.         this.fext = fext;
  270.         this.displayname = crop(fullname(fname,fext),<%= L_NAMECHARS_NUM %>);    
  271.         this.fsize = fsize;
  272.         this.displaysize = formatsize(fsize);
  273.         this.ftype = crop(ftype,<%= L_TYPECHARS_NUM %>);
  274.         this.nodetype = ftype
  275.         
  276.         this.sdate = lngLastUpdated;
  277.         this.lastupdated = strLastUpdated;
  278.         this.displaydate = crop(this.lastupdated ,<%= L_LASTMODIFIEDCHARS_NUM %>);
  279.         this.deleted = false;
  280.         this.updated = false;
  281.         this.newitem = false;
  282.         }
  283.     
  284.     cachedList = new Array();    
  285.     listFunc = new listFuncs();
  286.     
  287. </SCRIPT>
  288.  
  289. </BODY>
  290. </HTML>
  291.